﻿using SwyishChess.Domain.Board;
using SwyishChess.Domain.Piece;

namespace SwyishChess.Service
{
    public interface IMoveValidationService
    {
        /// <summary>
        /// Checks if a possible move from a chess piece is a valid move
        /// </summary>
        /// <param name="ChessPieces">Chess pieces in the game</param>
        /// <param name="cp">Chses piece</param>
        /// <param name="currentRow">Current row</param>
        /// <param name="currentColumn">Current column</param>
        /// <param name="newRow">New row</param>
        /// <param name="newColumn">New column</param>
        /// <returns>boolean value indicating whether the move is valid or not</returns>
        bool ValidateMove(ChessPiece[,] chessPieces, ChessPiece cp, int currentRow, int currentColumn, int newRow, int newColumn);
        /// <summary>
        /// Checks if check needs to be declared
        /// </summary>
        /// <param name="ChessPieces">Chess pieces in the game</param>
        /// <param name="ChessBoard">The game board</param>
        /// <returns>Boolean value indicating whether check needs to be declared or not</returns>
        bool CheckForCheck(ChessPiece[,] chessPieces, ChessBlock[,] chessBoard, out int checkedPlayerID);
        /// <summary>
        /// Look for movable blocks of a chess piece
        /// </summary>
        /// <param name="ChessPieces">Chess pieces in the game</param>
        /// <param name="GameBoard">The chess board</param>
        /// <param name="cp">The ches piece</param>
        /// <param name="row">The row location of the chess piece</param>
        /// <param name="column">The column location of the chess piece</param>
        void FindMovableChessBlock(ChessPiece[,] chessPieces, ChessBlock[,] gameBoard, ChessPiece cp, int row, int column);
        /// <summary>
        /// Checks whether the chess piece is eligible for promotion
        /// </summary>
        /// <param name="ChessPieces">The chess pieces array</param>
        /// <param name="cp">The check piece to be checked</param>
        /// <returns>Boolean value indicating whether the passed chess piece is eligible for promotion</returns>
        bool CheckForPawnPromotion(ChessPiece [,] chessPieces, ChessPiece cp);
        /// <summary>
        /// Checks if Castling is possible
        /// </summary>
        /// <param name="ChessPieces">Chess Pieces array</param>
        /// <param name="cp">The chess piece that are checked of eligibility on</param>
        /// <returns>Boolean value indicating whether it is eiligible for castling or not</returns>
        bool CheckForCastling(ChessPiece[,] chessPieces, ChessPiece cp);
        /// <summary>
        /// Checks if the last move was en passant so it can remove the piece that was passed
        /// </summary>
        /// <param name="chessPieces">Chess pieces array</param>
        /// <param name="cp">Just moved chess piece</param>
        /// <returns>Boolean value indicating whether it was en passant or not</returns>
        bool CheckIfLastMoveWasEnPassant(ChessPiece[,] chessPieces, ChessPiece cp);
        /// <summary>
        /// Checks if it is a game over by counting the number of chess pieces
        /// </summary>
        /// <param name="ChessPieces">Chess pieces array</param>
        /// <returns>Boolean value indicating whether it is game over or not</returns>
        bool CheckForGameOver(ChessPiece[,] chessPieces);
        /// <summary>
        /// Removes check cause moves from possible moves
        /// </summary>
        /// <param name="cpm">ChessPieceModel to get copied array</param>
        /// <param name="cbm">ChessBoardModel to get copied array</param>
        /// <param name="row">Row location to be removed</param>
        /// <param name="column">Column location to be removed</param>
        /// <param name="chessBlock">Chess board</param>
        /// <param name="cp">Chess peice</param>
        /// <returns>Returns how many possible moves there are</returns>
        int RemoveCheckCausingMoves(ChessPiecesModel cpm,  ChessBoardModel cbm, int currentTurn, 
            int row, int column, ChessBlock[,] chessBlock, ChessPiece cp);
        /// <summary>
        /// Set all pawns ineligible for en passant
        /// </summary>
        /// <param name="ChessPieces">Chess Pieces Array</param>
        void DisableEligibilityForEnPassant(ChessPiece[,] chessPieces);
    }
}
